﻿function get_Logs_Html(){
  var htmlstr='<table id="Grid_Logs" style="width:auto;height:auto"></table>';
  return htmlstr;
}
function Add_Logs_Tab(tabname){
  if(!$('#ttab').tabs('exists',tabname)){
	$('#ttab').tabs('add',{
		title:tabname,
		cache:false,
		closable:true,
		content:get_Logs_Html()
	  });
	var gridht = $('body').layout('panel','center').panel('options').height - 58;
	$('#Grid_Logs').datagrid({
	  border:false,
	  nowrap: false,
	  striped: true,
	  collapsible:true,
	  url:'/Data/Logs.ashx',
	  method:'get',
	  height:gridht,
	  queryParams:{type:"0"},
	  fitColumns:true,
	  loadMsg:'正在读取数据,请稍候...',
	  singleSelect:true,
	  columns:[[
		{field:'LogId',checkbox:true},
		{field:'AdminName',title:'管理员',width:80},
		{field:'LogType',title:'日志类型',width:80},
		{field:'Ip',title:'登录IP',width:80},
		{field:'LogTime',title:'记录时间',width:80}]],
	  pagination:true,
	  rownumbers:true,
	  onLoadError:function(er){
		  $.messager.alert('错误','可能无查看权限,无法加载数据!','error');
	  }
	});
  }else{
	$('#ttab').tabs('select',tabname);
  }
}